chore(ci): refine Claude Code Action workflows#4
Conversation
Replace the default-boilerplate @claude handler and the plugin-based auto-review with a tailored pair: claude.yml - Add concurrency group keyed on issue/PR number so rapid @claude mentions don't spawn parallel agent runs. - Bump permissions to write on pull-requests/issues so the agent can post comments and edit PR descriptions. - Set timeout-minutes: 30. - Pin model to claude-sonnet-4-6 and pass an allowlist covering the cargo / clippy / fmt / test toolchain plus npm / yarn / eslint / prettier / gh, alongside Read/Edit/Write/Glob/Grep. claude-code-review.yml - Replace the marketplace plugin invocation with an inline diff + file-context build + curl-to-Anthropic flow that returns a single review comment with token usage and cost line. - 4000-line cost guard skips oversized diffs with an explanatory comment, keeping spend predictable. - Filter out lockfiles (pnpm/npm/yarn/Cargo.lock) and binary assets from the diff. - Include both .ts/.tsx/.js/.jsx and .rs in the changed-file context. Walk imports for TS/JS only; Rust files appear as CHANGED without related-file resolution (Rust mod resolution is non-trivial). - Tailored system prompt covers CoreMQ specifics: AdminCommand wiring, oneshot reply requirement, packet_id panic class, blocking-in-async, channel deadlocks, theme tokens, and the en/ko/uz i18n triplet rule. - Concurrency cancels in-progress reviews when a new push lands.
🤖 Claude Code ReviewSummaryTwo CI workflow files replacing boilerplate with a production-tuned pair. The logic is mostly sound but has a few real issues worth fixing. IssuesMajor — Major — Minor — Minor — Nits
Reviewed by claude-sonnet-4-6 · diff: 384 lines · context: 0 lines · tokens: 6819 in / 809 out · cost: $0.032592 · tag to ask follow-up questions |
@claude review this |
|
Claude finished @Sardor-M's task in 3m 10s —— View job Claude Code Review
🤖 Claude Code ReviewSummarySolid direction overall — the inline reviewer is more cost-controlled and CoreMQ-tailored than the marketplace plugin it replaces. The earlier bot review on this thread caught the two material bugs; I'll confirm them concretely and add a few it missed. Confirming the prior bot's findingsMajor — Awk drops the DIFF=$(echo "$RAW_DIFF" | awk '
/^diff --git/ { skip = ($0 ~ /(pnpm-lock\.yaml|package-lock\.json|yarn\.lock|Cargo\.lock|\.(png|jpg|svg|ico|map))( |$)/) }
!skip
' | head -n 8000)Major — STOP_REASON=$(echo "$RESPONSE" | jq -r '.stop_reason // ""')
if [ "$STOP_REASON" = "max_tokens" ]; then
REVIEW="${REVIEW}
> ⚠️ Review truncated at max_tokens — re-tag \`@claude\` for the rest."
fiMinor — Minor — Additional issues the prior review missedMinor — system: [
{ type: "text", text: "Concise code reviewer for the CoreMQ project — ...", cache_control: { type: "ephemeral" } }
]Minor — Minor — Nit — Nit — On the prior bot's nits
Fix the lockfile filter → · Raise max_tokens and handle truncation → · Add prompt caching → · branch |
@otabek05 Can you confirm these changes ? |
Summary
Replace the default-boilerplate
@claudehandler and the plugin-based auto-review with a tailored pair adapted from a production-tested setup. Same two files, materially different behavior.claude.yml(the@claudemention handler)@claudementions on the same PR no longer spawn parallel agent runs.pull-requestsandissuesso the agent can post comments and edit PR descriptions (was: read-only).timeout-minutes: 30to bound runaway jobs.claude-sonnet-4-6.cargo check/build/test/clippy/fmt,npm run *,npx prettier/eslint,yarn *, plusgh pr/api,git diff/log/show, andRead/Edit/Write/Glob/Grep.claude-code-review.yml(auto PR review)Replace the marketplace
code-reviewplugin with an inline reviewer:@claudefor targeted asks. Keeps spend predictable (~$0.10–0.20 per run on Sonnet 4.6).pnpm-lock,package-lock,yarn.lock,Cargo.lock, images, and source maps are stripped from the diff before review..ts/.tsx/.js/.jsxand.rsfiles appear asCHANGED(up to 600 lines each, with truncation markers so the reviewer doesn't false-positive on missing identifiers). For TS/JS files, imports are resolved transitively to addRELATEDfiles (200 lines each). Rust mod resolution is non-trivial, so.rsfiles appear without related-file walking.AdminCommandwiring (oneshot reply requirement),packet_idpanic class, blocking syscalls in async, channel deadlocks, hardcoded colors, and theen.json/ko.json/uz.jsoni18n triplet rule. Tells the reviewer not to invent issues from truncated context.What it looks like in practice
A PR review comment will look like:
Test plan
ANTHROPIC_API_KEYis present in repo Actions secrets (already required for the existing workflows — same secret name).claude-code-review.ymlposts a review comment within ~1 minute of the push.@claudein a comment on this PR and verifyclaude.ymlresponds.Notes
workflowscope is required to land changes under.github/workflows/— already on this token.